Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es-set-tostringtag

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-set-tostringtag

A helper to optimistically set Symbol.toStringTag, when possible.

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29M
increased by2.78%
Maintainers
0
Weekly downloads
 
Created
Source

es-set-tostringtag Version Badge

github actions coverage License Downloads

npm badge

A helper to optimistically set Symbol.toStringTag, when possible.

Example

Most common usage:

var assert = require('assert');
var setToStringTag = require('es-set-tostringtag');

var obj = {};

assert.equal(Object.prototype.toString.call(obj), '[object Object]');

setToStringTag(obj, 'tagged!');

assert.equal(Object.prototype.toString.call(obj), '[object tagged!]');

Options

An optional options argument can be provided as the third argument. The available options are:

force

If the force option is set to true, the toStringTag will be set even if it is already set.

nonConfigurable

If the nonConfigurable option is set to true, the toStringTag will be defined as non-configurable when possible.

Tests

Simply clone the repo, npm install, and run npm test

FAQs

Package last updated on 02 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc